package com.dragon.repository.domain.vo;

import com.dragon.common.model.Update;
import com.dragon.repository.entity.TechnicalPerson;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.dragon.common.util.BeanUtils;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;


/**
 * @author sy
 */
@Data
@ApiModel(value = "")
public class TechnicalPersonVO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "技术联系人名称")
    private String technicalName;

    @ApiModelProperty(value = "技术联系人手机号")
    private String technicalPhone;

    @ApiModelProperty(value = "技术联系人职位")
    private String technicalPosts;

    @ApiModelProperty(value = "技术联系人微信")
    private String technicalVx;


    @NotNull(groups = Update.class,message = "主键不能为空")
    public static TechnicalPerson convert(TechnicalPersonVO vo) {
        TechnicalPerson entity = new TechnicalPerson();
        BeanUtils.copyProperties(vo,entity);
        return entity;
    }
    public static List<TechnicalPerson> convertList(List<TechnicalPersonVO> list) {
        List<TechnicalPerson> resultList = new ArrayList<>();
        for (TechnicalPersonVO vo : list) {
            resultList.add(convert(vo));
        }
        return resultList;
    }
}
